More getting xenlinux/ia64 to build with drivers from -sparse
authordjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Fri, 23 Sep 2005 17:15:48 +0000 (11:15 -0600)
committerdjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Fri, 23 Sep 2005 17:15:48 +0000 (11:15 -0600)
linux-2.6-xen-sparse/arch/ia64/xen-mkbuildtree-pre
linux-2.6-xen-sparse/arch/ia64/xen/drivers/Makefile
linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/blkback.c.patch [new file with mode: 0644]
linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/console.c.patch [new file with mode: 0644]
linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/devmem.c.patch [new file with mode: 0644]
linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/gnttab.c.patch [new file with mode: 0644]
linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/privcmd.c.patch [new file with mode: 0644]
linux-2.6-xen-sparse/include/asm-xen/asm-ia64/fixmap.h [new file with mode: 0644]

index 2870c0795e1c6b47a32c4beba603607980513e5c..29191f14aa92547aa2a368a429d97e4db1054fde 100755 (executable)
@@ -1,7 +1,15 @@
 #!/bin/bash
-if [ -e mm ]
+# restructure directories to match future drivers/xen plan
+# and move aside xen/x86 specific changes
+# WARNING!: This directory movement really confuses hg which makes
+# it difficult to do development in a directory which is being used
+# for building (as all files in mv'd directories are thought by hg
+# to have been deleted).  I don't know how to avoid this right now,
+# but if someone has a better way, I'm all ears
+if [ ! -e mm.xen-x86 ]
 then
        mv mm mm.xen-x86
+       mkdir mm
        mv net net.xen-x86
        mv kernel kernel.xen-x86
        mv drivers/acpi/tables.c drivers/acpi/tables.c.xen-x86
@@ -11,9 +19,32 @@ then
        mv arch/xen.xen-x86/configs arch/xen
        mv include/asm-generic include/asm-generic.xen-x86
        mv include/linux include/linux.xen-x86
+       mkdir include/linux
 fi
+
+# need to grab a couple of xen-modified files for generic_page_range and
+# typedef pte_fn_t which are used by driver/xen blkif
+cp mm.xen-x86/memory.c mm/memory.c
+cp include/linux.xen-x86/mm.h include/linux/mm.h
+
+#eventually asm-xsi-offsets needs to be part of hypervisor.h/hypercall.h
 cp ../xen/include/asm-ia64/asm-xsi-offsets.h include/asm-ia64/xen/
+
+#ia64 drivers/xen isn't fully functional yet, workaround...
+#also ignore core/evtchn.c which uses a different irq mechanism than ia64
+#(warning: there be dragons here if these files diverge)
 cp arch/ia64/xen/drivers/Makefile drivers/xen/Makefile
 cp arch/ia64/xen/drivers/coreMakefile drivers/xen/core/Makefile
+
+#not sure where these ia64-specific files will end up in the future
 cp arch/ia64/xen/drivers/xenia64_init.c drivers/xen/core
 cp arch/ia64/xen/drivers/evtchn_ia64.c drivers/xen/core
+
+#still a few x86-ism's in various drivers/xen files, patch them
+cd drivers/xen
+if [ ! -e ia64.patch.semaphore ]
+then
+       cat ../../arch/ia64/xen/drivers/patches/* | patch -p1 -b
+fi
+touch ia64.patch.semaphore
+cd ../..
index efe02ba77c12d5d9115e89bf70cc970a00acd975..57394ea9fb7cf7c959da371d169cc8d2d8164b7e 100644 (file)
@@ -1,4 +1,5 @@
 
+obj-y   += util.o
 
 obj-y  += core/
 obj-y  += console/
diff --git a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/blkback.c.patch b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/blkback.c.patch
new file mode 100644 (file)
index 0000000..0554403
--- /dev/null
@@ -0,0 +1,57 @@
+diff -Naur xen/blkback/blkback.c xen.patched/blkback/blkback.c
+--- xen/blkback/blkback.c      2005-09-23 10:54:50.000000000 -0600
++++ xen.patched/blkback/blkback.c      2005-09-23 10:57:51.000000000 -0600
+@@ -30,10 +30,16 @@
+ static unsigned long mmap_vstart;
+ #define MMAP_PAGES                                            \
+       (MAX_PENDING_REQS * BLKIF_MAX_SEGMENTS_PER_REQUEST)
++#ifdef __ia64__
++static void *pending_vaddrs[MMAP_PAGES];
++#define MMAP_VADDR(_idx, _i) \
++      (unsigned long)(pending_vaddrs[((_idx) * BLKIF_MAX_SEGMENTS_PER_REQUEST) + (_i)])
++#else
+ #define MMAP_VADDR(_req,_seg)                                         \
+       (mmap_vstart +                                                  \
+        ((_req) * BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE) +        \
+        ((_seg) * PAGE_SIZE))
++#endif
+ /*
+  * Each outstanding request that we've passed to the lower device layers has a 
+@@ -377,9 +383,13 @@
+                       goto bad_descriptor;
+               }
++#ifdef __ia64__
++              MMAP_VADDR(pending_idx,i) = gnttab_map_vaddr(map[i]);
++#else
+               phys_to_machine_mapping[__pa(MMAP_VADDR(
+                       pending_idx, i)) >> PAGE_SHIFT] =
+                       FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT);
++#endif
+               pending_handle(pending_idx, i) = map[i].handle;
+       }
+@@ -500,9 +510,22 @@
+       blkif_interface_init();
++#ifdef __ia64__
++    {
++      extern unsigned long alloc_empty_foreign_map_page_range(unsigned long pages);
++      int i;
++
++      mmap_vstart =  alloc_empty_foreign_map_page_range(MMAP_PAGES);
++      printk("Allocated mmap_vstart: 0x%lx\n", mmap_vstart);
++      for(i = 0; i < MMAP_PAGES; i++)
++          pending_vaddrs[i] = mmap_vstart + (i << PAGE_SHIFT);
++      BUG_ON(mmap_vstart == NULL);
++    }
++#else
+       page = balloon_alloc_empty_page_range(MMAP_PAGES);
+       BUG_ON(page == NULL);
+       mmap_vstart = (unsigned long)pfn_to_kaddr(page_to_pfn(page));
++#endif
+       pending_cons = 0;
+       pending_prod = MAX_PENDING_REQS;
diff --git a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/console.c.patch b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/console.c.patch
new file mode 100644 (file)
index 0000000..12e9a01
--- /dev/null
@@ -0,0 +1,20 @@
+diff -Naur xen/console/console.c xen.patched/console/console.c
+--- xen/console/console.c      2005-09-23 10:54:50.000000000 -0600
++++ xen.patched/console/console.c      2005-09-23 10:57:51.000000000 -0600
+@@ -768,9 +768,16 @@
+ #endif
+       if (xen_start_info->flags & SIF_INITDOMAIN) {
++#ifdef __ia64__
++              xencons_priv_irq = bind_virq_to_evtchn(VIRQ_CONSOLE);
++              bind_evtchn_to_irqhandler(xencons_priv_irq,
++                              xencons_priv_interrupt, 0, "console", NULL);
++#else
++
+               xencons_priv_irq = bind_virq_to_irq(VIRQ_CONSOLE);
+               (void)request_irq(xencons_priv_irq,
+                                 xencons_priv_interrupt, 0, "console", NULL);
++#endif
+       } else {
+               xencons_ring_register_receiver(xencons_rx);
+       }
diff --git a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/devmem.c.patch b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/devmem.c.patch
new file mode 100644 (file)
index 0000000..ec6e9b3
--- /dev/null
@@ -0,0 +1,13 @@
+diff -Naur xen/core/devmem.c xen.patched/core/devmem.c
+--- xen/core/devmem.c  2005-09-23 10:54:50.000000000 -0600
++++ xen.patched/core/devmem.c  2005-09-23 10:57:51.000000000 -0600
+@@ -93,6 +93,9 @@
+       if (uncached_access(file))
+               vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
++#ifdef __ia64__
++#define       direct_remap_pfn_range(a,b,c,d,e,f)     remap_pfn_range(a,b,c,d,e)
++#endif
+       if (direct_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
+                                  vma->vm_end - vma->vm_start,
+                                  vma->vm_page_prot, DOMID_IO))
diff --git a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/gnttab.c.patch b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/gnttab.c.patch
new file mode 100644 (file)
index 0000000..78ce7f7
--- /dev/null
@@ -0,0 +1,68 @@
+diff -Naur xen/core/gnttab.c xen.patched/core/gnttab.c
+--- xen/core/gnttab.c  2005-09-23 10:54:50.000000000 -0600
++++ xen.patched/core/gnttab.c  2005-09-23 10:57:51.000000000 -0600
+@@ -22,6 +22,10 @@
+ #include <asm-xen/gnttab.h>
+ #include <asm/synch_bitops.h>
++#ifdef __ia64__
++#define synch_cmpxchg ia64_cmpxchg4_acq
++#endif
++
+ #if 1
+ #define ASSERT(_p) \
+     if ( !(_p) ) { printk(KERN_ALERT"Assertion '%s': line %d, file %s\n", \
+@@ -339,6 +343,10 @@
+     if ( hypercall.op != __HYPERVISOR_grant_table_op )
+         return -ENOSYS;
++
++#ifdef __ia64__
++    ret = HYPERVISOR_grant_table_op(hypercall.arg[0], (void *)hypercall.arg[1], hypercall.arg[2]);
++#else
+     /* hypercall-invoking asm taken from privcmd.c */
+     __asm__ __volatile__ (
+         "pushl %%ebx; pushl %%ecx; pushl %%edx; pushl %%esi; pushl %%edi; "
+@@ -351,6 +359,7 @@
+         TRAP_INSTR "; "
+         "popl %%edi; popl %%esi; popl %%edx; popl %%ecx; popl %%ebx"
+         : "=a" (ret) : "0" (&hypercall) : "memory" );
++#endif
+     return ret;
+ }
+@@ -414,8 +423,13 @@
+     BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1) != 0);
+     BUG_ON(setup.status != 0);
++#ifdef __ia64__
++    shared = __va(frames[0] << PAGE_SHIFT);
++    printk("grant table at %p\n", shared);
++#else
+     for ( i = 0; i < NR_GRANT_FRAMES; i++ )
+         set_fixmap(FIX_GNTTAB_END - i, frames[i] << PAGE_SHIFT);
++#endif
+     return 0;
+ }
+@@ -425,8 +439,10 @@
+ {
+     int i;
++#ifndef __ia64__
+     for ( i = 0; i < NR_GRANT_FRAMES; i++ )
+       clear_fixmap(FIX_GNTTAB_END - i);
++#endif
+     return 0;
+ }
+@@ -441,7 +457,9 @@
+     BUG_ON(gnttab_resume());
++#ifndef __ia64__
+     shared = (grant_entry_t *)fix_to_virt(FIX_GNTTAB_END);
++#endif
+     for ( i = 0; i < NR_GRANT_ENTRIES; i++ )
+         gnttab_list[i] = i + 1;
diff --git a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/privcmd.c.patch b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/privcmd.c.patch
new file mode 100644 (file)
index 0000000..c3903ba
--- /dev/null
@@ -0,0 +1,49 @@
+diff -Naur xen/privcmd/privcmd.c xen.patched/privcmd/privcmd.c
+--- xen/privcmd/privcmd.c      2005-09-23 10:54:50.000000000 -0600
++++ xen.patched/privcmd/privcmd.c      2005-09-23 10:57:51.000000000 -0600
+@@ -134,6 +134,9 @@
+                                   > vma->vm_end )
+                                       return -EINVAL;
++#ifdef __ia64__
++#define       direct_remap_pfn_range(a,b,c,d,e,f) remap_pfn_range(a,b,c,d,e)
++#endif
+                               if ((rc = direct_remap_pfn_range(
+                                       vma,
+                                       msg[j].va&PAGE_MASK, 
+@@ -148,6 +151,7 @@
+       }
+       break;
++#ifndef __ia64__
+       case IOCTL_PRIVCMD_MMAPBATCH: {
+               mmu_update_t u;
+               privcmd_mmapbatch_t m;
+@@ -206,7 +210,9 @@
+       }
+       break;
+ #endif
++#endif
++#ifndef __ia64__
+       case IOCTL_PRIVCMD_GET_MACH2PHYS_START_MFN: {
+               unsigned long m2pv = (unsigned long)machine_to_phys_mapping;
+               pgd_t *pgd = pgd_offset_k(m2pv);
+@@ -218,6 +224,7 @@
+                       -EFAULT: 0;
+       }
+       break;
++#endif
+       case IOCTL_PRIVCMD_INITDOMAIN_STORE: {
+               extern int do_xenbus_probe(void*);
+@@ -241,6 +248,9 @@
+               /* Initial connect. Setup channel and page. */
+               xen_start_info->store_evtchn = data;
++#ifdef __ia64__
++#define       pfn_to_mfn(x)   (x)
++#endif
+               xen_start_info->store_mfn =
+                       pfn_to_mfn(virt_to_phys((void *)page) >>
+                                  PAGE_SHIFT);
diff --git a/linux-2.6-xen-sparse/include/asm-xen/asm-ia64/fixmap.h b/linux-2.6-xen-sparse/include/asm-xen/asm-ia64/fixmap.h
new file mode 100644 (file)
index 0000000..40a8c17
--- /dev/null
@@ -0,0 +1 @@
+/* empty */